<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html  xmlns="http://www.w3.org/1999/xhtml"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:p="http://primefaces.org/ui"
       xmlns:cc="http://java.sun.com/jsf/composite">
	      
	     <!--INFERFACE-->
	     <cc:interface>  
	         <cc:attribute name="dataPeriodo" />  
	         <cc:attribute name="dataFieldFilter" />  
	     </cc:interface>  
	     
	     <!--IMPLEMENTATION--> 
	     <cc:implementation> 
	     
	       <div style="height: 30px">
	       
		       <p:outputPanel id="panelComponent"  >
		       
		          <h:outputLabel id="idDataFieldFilter" value="#{dataPeriodoComponent.setDataFieldFielter(cc.attrs.dataFieldFilter)}" 
		                          style="display: none:"  />  
		       
		          <p:outputPanel  rendered="#{!dataPeriodoComponent.isEscolherPeriodo}">
		             <h:panelGrid columns="2" cellspacing="2" cellpadding="2"> 
		                 <h:outputLabel value="#{cc.attrs.dataLabel}" /> 
		                 <p:selectOneMenu id="selectOneMenu" value="#{cc.attrs.dataPeriodo}" converter="#{dataPeriodoConverter}" 
		                                  style="width: 180px" >  
		                                  
				             <f:selectItems value="#{dataPeriodoComponent.listDataPeriodo}"  var="dataPeriodo" 
				                            itemLabel="#{dataPeriodo.dataLabel}" itemValue="#{dataPeriodo}"/>  
				                           
				             <p:ajax  event="change" listener="#{dataPeriodoComponent.escolherPeriodo(cc.attrs.dataPeriodo)}"
				                      partialSubmit="true" process="@this,idDataFieldFilter,selectOneMenu" update="idDataFieldFilter,panelComponent"/>  
				                                  
				         </p:selectOneMenu>  
				         
				        
				    </h:panelGrid>     
	              </p:outputPanel>
	              
	              <p:outputPanel  rendered="#{dataPeriodoComponent.isEscolherPeriodo}">
	              
	              <h:panelGrid columns="10" cellspacing="1" cellpadding="1">
	              
		                  <!--DATA INICIAL-->   
				          <p:calendar    value="#{cc.attrs.dataPeriodo.dataInicial}"
		                                 locale="pt"
		                                 pattern="dd/MM/yyyy"
		                                 effect="fade"
		                                 onkeyup="mascaraData(this)"
		                                 size="10"
		                                 maxlength="10"
		                                 label="#{msg['componente-dataperiodo-label-datainicial']}"/>
		                                 
		                  <!--DATA FINAL-->   
				          <h:outputLabel value="-" />
				          <p:spacer width="1" />
				          <p:calendar    value="#{cc.attrs.dataPeriodo.dataFinal}"
		                                 locale="pt"
		                                 pattern="dd/MM/yyyy"
		                                 effect="fade"
		                                 onkeyup="mascaraData(this)"
		                                 size="10"
		                                 maxlength="10"
		                                 label="#{msg['componente-dataperiodo-label-datafinal']}"/> 
		                                 
		                  <!-- APLICAR -->    
		                  <p:commandButton  icon="ui-icon-arrowrefresh-1-w" title="#{msg['componente-dataperiodo-btn-title-retornar']}" 
		                                    style="width: 21px; height: 21px;"
		                                    action="#{dataPeriodoComponent.retornar()}" update="panelComponent,selectOneMenu" />      
	                </h:panelGrid>                  
	              </p:outputPanel>
	              
	           </p:outputPanel>  
	              
	       </div>
	     </cc:implementation>  
     
 </html>     
